import logging
import os

logger = logging.getLogger('zwdh_admin')
logger.setLevel(logging.DEBUG)

format = logging.Formatter('[%(asctime)s] [%(levelname)s] [%(funcName)s] %(message)s')
path = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) # 上级目录

f = logging.FileHandler(filename=f'{path}/log/zwdh.log',mode='a',encoding='utf8')
f.setFormatter(format)
s = logging.StreamHandler()
s.setFormatter(format)

logger.addHandler(f)
logger.addHandler(s)